/*
 * @Author: thats-all-right-ha-ha 8280209+thats-all-right-ha-ha@user.noreply.gitee.com
 * @Date: 2024-03-01 11:13:54
 * @LastEditors: thats-all-right-ha-ha 8280209+thats-all-right-ha-ha@user.noreply.gitee.com
 * @LastEditTime: 2024-03-07 09:14:14
 * @FilePath: \hrManage\src\api\employee.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import instance from '@/utils/request'

export const getEmployee = (params) => {
  return instance.get('/sys/user', {
    params
  })
}

export function exportEmployee() {
  return instance({
    url: '/sys/user/export',
    // 改变接收数据的类型
    responseType: 'blob' // 使用blob接收二进制文件流
  })
}

export const employeeTemplate = () => {
  return instance.get('/sys/user/import/template', {
    responseType: 'blob'
  })
}

export const submitFile = (data) => {
  return instance.post('/sys/user/import', data)
}

export const delEmployee = (id) => {
  return instance.delete(`/sys/user/${id}`)
}

export const addEmployee = (data) => {
  return instance.post('/sys/user', data)
}

export const getEmployeeDetail = (id) => {
  return instance.get(`/sys/user/${id}`)
}

export const updateEmployeeDetail = (data) => {
  return instance.put(`/sys/user/${data.id}`, data)
}

export const updateAssignRoles = (data) => {
  return instance.put('/sys/user/assignRoles', data)
}
